package com.only4play.practice.common.enums.pay;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.only4play.codegen.support.constants.BaseEnum;

import java.util.Optional;

/**
 * @author mengdy
 */

public enum OutPayChannelType implements BaseEnum<OutPayChannelType> {

  /** 支付宝 - 直连商户 */
  ALIPAY(10,"ALI"),
  /** 微信支付 */
  WECHAT(20,"WECHAT"),
  /** 云闪付 */
  UNION_PAY(30,"UNION_PAY"),
  ;

  OutPayChannelType(Integer code, String name) {
    this.code = code;
    this.name = name;
  }

  @EnumValue
  private Integer code;
  private String name;

  @Override
  public Integer getCode() {
    return this.code;
  }

  @Override
  public String getName() {
    return this.name;
  }

  public static Optional<OutPayChannelType> of(Integer code) {
    return Optional.ofNullable(BaseEnum.parseByCode(OutPayChannelType.class, code));
  }

}
